<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-10-19 10:27:04
 * @Description: 购物车
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-10-19 18:05:11
 * @FilePath: /归档/base/2021_10_19_102704_create_cart.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCart extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('carts', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('user_id')->default(0)->comment('用户ID');
            $table->foreignId('store_id')->default(0)->comment('店铺ID');
            $table->foreignId('good_id')->default(0)->comment('商品ID');
            $table->foreignId('good_specs_id')->default(0)->comment('规格ID');
            $table->string('good_specs_title', 100)->comment('规格名称')->nullable();
            $table->string('good_title', 100)->comment('商品名称');
            $table->string('good_thumb', 255)->comment('商品封面图');
            $table->unsignedInteger('nums')->comment('数量');
            $table->decimal('price')->default(0)->comment('单价');
            $table->decimal('total_price')->default(0)->comment('总价');
            $table->tinyInteger('selected')->default(0)->comment('购物车选中状态 1选中 0未选中');
            $table->tinyInteger('prom_type')->default(0)->comment('0普通商品，1限时，2团购，3满赠，4活动');
            $table->foreignId('prom_id')->default(0)->comment('活动ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('carts');
    }
}
